package part04_观察者模式.p01_传统方法;

/** 当前的天气情况（就是观察者）
 *
 * @ClassName: CurrentCondition
 * @Author: AllenSun
 * @Date: 2019/12/6 19:21
 */
public class CurrentCondition {
    private float temperature;
    private float pressure;
    private float humidity;

    //更新，当有新的数据传入时，就会更新
    public void update(float temperature, float pressure, float humidity){
        this.temperature=temperature;
        this.pressure=pressure;
        this.humidity=humidity;
        display();
    }

    //展示信息
    public void display(){
        System.out.println("****今天温度为:"+temperature+"****");
        System.out.println("****今天气压为:"+pressure+"****");
        System.out.println("****今天湿度为:"+humidity+"****");
    }
}
